package net.httpconn;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;

public class DeleteCommand extends HttpCommand {
	

	public String execute() {
		
		StringBuffer responseBuffer = new StringBuffer();
		BufferedReader bReader = null;
		String response = null;
		try {
			if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
				bReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
				String line = null;
				while((line = bReader.readLine()) != null) { responseBuffer.append(line); }
			} 
			else  responseBuffer.append(connection.getResponseCode());
			
			response = responseBuffer.toString();
		} 
		catch (Throwable t) {
			response = ExceptionLogger.logThrowable(t);
		}
		finally	{super.finalizeConnection();}
		
		return response;
	}
	
}
